package com.example.deal.broker.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import com.example.deal.broker.entity.Deal;

@RestController
public class BrokerController {
  @Autowired
  private RestTemplate restTemplate;

  @GetMapping("/deal/{id}")
  public Deal findById(@PathVariable Long id) {
    return this.restTemplate.getForObject("http://microservice-deal-cloud/deal/" + id, Deal.class);
  }
}